let vcs = match (opts.version_control, cfg.version_control, in_existing_vcs_repo) {
(None, None, false) => VersionControl::Git,
(None, Some(option), false) => option,
- (Some(option), _, false) => option,
+ (Some(option), _, _) => option,
(_, _, true) => VersionControl::NoVcs,
};
is_not(existing_file()));
});
+test!(subpackage_git_with_vcs_arg {
+ assert_that(cargo_process("new").arg("foo").env("USER", "foo"),
+ execs().with_status(0));
+
+ let subpackage = paths::root().join("foo").join("components");
+ fs::create_dir(&subpackage).unwrap();
+ assert_that(cargo_process("new").arg("foo/components/subcomponent")
+ .arg("--vcs").arg("git")
+ .env("USER", "foo"),
+ execs().with_status(0));
+
+ assert_that(&paths::root().join("foo/components/subcomponent/.git"),
+ existing_dir());
+ assert_that(&paths::root().join("foo/components/subcomponent/.gitignore"),
+ existing_file());
+});
+
test!(unknown_flags {
assert_that(cargo_process("new").arg("foo").arg("--flag"),
execs().with_status(1)